﻿@model SoftHotel.Models.ReservaHab

@{
    ViewBag.Title = "Agregar";
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<link href="@Url.Content("~/Content/themes/base/jquery.ui.core.css")"  
        rel="stylesheet" type="text/css" /> 
<link href="@Url.Content("~/Content/themes/base/jquery.ui.datepicker.css")"  
        rel="stylesheet"  type="text/css" /> 
<link href="@Url.Content("~/Content/themes/base/jquery.ui.theme.css")"  
        rel="stylesheet" type="text/css" /> 
<link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
 
<script src="@Url.Content("~/Scripts/jquery.ui.core.js")"  
        type="text/javascript"></script> 
<script src="@Url.Content("~/Scripts/jquery.ui.datepicker.js")"  
        type="text/javascript"></script> 
<script src="@Url.Content("~/Scripts/jquery.validate.js")"  
        type="text/javascript"></script> 
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>    
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>


<script type="text/javascript">
    $(document).ready(function () {

        $('.date').datepicker
        ({

            dayNamesMin: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa"],
            monthNames: ["January", "February", "March", "April", "Mayo", "Junio", "Julio", "August", "September", "October", "November", "December"],
            dateFormat: 'dd/mm/yy',
            minDate: 0

        });
    });

</script>

<script type="text/javascript">

    var linkObj;
    $(function () {
        $(".busqueda").button();

        $('#searchDialog').dialog({
            autoOpen: false,
            width: 900,
            resizable: false,
            modal: true
            //            buttons: {
            //                
            //                "Cancel": function () {
            //                    $(this).dialog("close");
            //                }
            //            }
        });

        $(".busqueda").click(function () {
            //change the title of the dialgo
            linkObj = $(this);
            var dialogDiv = $('#searchDialog');
            var viewUrl = linkObj.attr('href');
            $.get(viewUrl, function (data) {
                dialogDiv.html(data);

                //open dialog
                dialogDiv.dialog('open');
            });
            return false;
        });

    });


    function searchSuccess() {
        var id = $("#update-message").html();
        //we update the table's info
        var parent = linkObj.closest("tr");
        document.getElementById('idCliente').value = $("#idCliente" + id.toString()).val();
        document.getElementById('nombreRazonSocial').value = $("#nombres" + id.toString()).val();
        document.getElementById('tipoDocumento').value = $("#tipoDoc" + id.toString()).val();
        document.getElementById('numeroDocumento').value = $("#numDoc" + id.toString()).val();


        //now we can close the dialog
        $('#searchDialog').dialog('close');
    }
</script>

 <div id="searchDialog" title="Buscar Cliente"></div>

@using (Html.BeginForm())
{   
    @Html.ValidationSummary(true)
    <h1><strong>Reserva Habitaciones</strong></h1>
    <br />
    <fieldset>
        <legend>Nueva Reserva de Habitaciones</legend>
    <table id="MainContent_Table1" rules="none" style="border-color: Black; width: 900px; margin-bottom: 0px;"> 
            <tbody><tr>
	          <td style="width: 20px;"></td>
	          <td style="font-weight: bold;">Cliente: </td>
	          <td>        
                 @Html.TextBoxFor(model => model.idCliente)
                    <!--//aqui todo!-->
             </td><td>   
                 <a class="busqueda" href="/ReservaHab/BuscarCliente"> <img src="/Content/Images/buscar.png" alt="0" title="Buscar" id="" border="0" height="16" width="16"/></a>        
              </td>
	          <td style="font-weight: bold;">Nombre/Razón Social </td>
	          <td><div class="editor-field">
                    @Html.TextBoxFor(model => model.nombreRazonSocial, new { disabled = "disabled" })
            
                </div></td>
	        </tr>

            <tr>
	          <td style="width: 20px;"></td>
	          <td style="font-weight: bold;">Tipo de documento </td>
	          <td><div class="editor-field">
                    @Html.TextBoxFor(model => model.tipoDocumento, new { disabled = "disabled" })
           
                </div> </td>
              <td style="width: 100px;"></td>
	          <td style="font-weight: bold;">Número de documento </td>
	          <td><div class="editor-field">
                   @Html.TextBoxFor(model => model.numeroDocumento, new { disabled = "disabled" })
           
                </div></td>
	        </tr>
            
            <tr>
                <td style="width: 20px;"></td>
                <td style="font-weight: bold; width: 220px;">Fecha de Check-in</td>
		        <td style="width: 220px;"><div class="editor-field"> 
                @Html.TextBox("fechaCheckin", String.Format("{0:d}", (string)Model.fechaCheckin.ToShortDateString()), new { @class = "date", @Value = DateTime.Now.ToShortDateString() })
                @Html.ValidationMessageFor(model => model.fechaCheckin)
                </div> </td>
                <td style="width: 100px;"></td>
		        <td style="font-weight: bold; width: 220px;">Fecha de Check-out</td>
		        <td style="width: 220px;"><div class="editor-field"> 
                @Html.TextBox("fechaCheckout", String.Format("{0:d}", (string)Model.fechaCheckout.ToShortDateString()), new { @class = "date", @Value = DateTime.Now.ToShortDateString() })
                @Html.ValidationMessageFor(model => model.fechaCheckout)
                </div> </td>
	        </tr>

    </tbody></table>
    </fieldset>
    <br /> 
    <br />
 <fieldset>
    <legend>Detalle de Reserva</legend>

                <input type="submit" name="button" value="Añadir" />
 </fieldset>

<br />
    <form action = "Agregar" method = "post">
        <center>
	        <input value="Guardar" type="submit" name = "button"/> @{/* que estos sean tipo button*/}
	        <input value="Cancelar" type="submit" name = "button"/>
        </center>
    </form>
}